<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>崇伍操作日志</title>
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-7ymO4nGrkm372HoSbq1OY2DP4pEZnMiA+E0F3zPr+JQQtQ82gQ1HPY3QIVtztVua" crossorigin="anonymous"></script>
        <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    </head>
    <body style="margin: 0;padding: 0;overflow: hidden;">
     <div class="row" style="padding-top: 15px;">
         <form style="padding-left: 55px;">
             <div class="form-row align-items-center">
                 <div class="col-auto">
                     <label class="sr-only" for="inlineFormInput">开始时间</label>
                     <input type="text" class="form-control mb-2" name="start_time" value="{{ $start_time?date('Y/m/d H:i:s',$start_time):'' }}" placeholder="开始时间">
                 </div>
                 <div class="col-auto">
                     <label class="sr-only" for="inlineFormInputGroup">结束时间</label>
                     <div class="input-group mb-2">
                         <input type="text" class="form-control"  name="end_time" value="{{ $end_time?date('Y/m/d H:i:s',$end_time):'' }}" placeholder="结束时间">
                     </div>
                 </div>

                 <div class="col-auto">
                     <button type="submit" class="btn btn-primary mb-2">搜索</button>
                 </div>
                 <div style="float: right;color: #27de21;margin-left: 50px;">
                     总计：{{ $total }}条
                 </div>
             </div>
         </form>
         <div class="table-scrollable" style="overflow: auto; height: 800px; ">
             <table class="table table-dark table-hover table-bordered table-striped">
                 <thead>
                 <tr>
                     <th scope="col" class="text-center">操作人</th>
                     <th scope="col" class="text-center">操作类型</th>
                     <th scope="col" class="text-center">请求地址</th>
                     <th scope="col" class="text-center">操作时间</th>
                     <th scope="col" class="text-center">操作内容</th>
                 </tr>
                 </thead>
                 <tbody>
                 @foreach ($log as $g)
                     <tr>
                         <td class="text-center">
                             <div style="width: 150px;">
                                 {{ $g->user_id.'-'.$g->name }}
                             </div>
                         </td>
                         <td class="text-center">
                             <div style="width: 100px;">
                                 {{ $g->method }}
                             </div>
                         </td>
                         <td class="text-center">
                             <div style="width: 260px;">
                                 {{ $g->request_url }}
                             </div>
                         </td>
                         <td class="text-center">
                             <div style="width: 220px;">
                                 {{ date('Y/m/d H:i:s',$g->create_time) }}
                             </div>
                         </td>
                         <td class="text-center">
                             <div class="overflow-auto">
                                 {!! $g->content !!}
                             </div>
                         </td>
                     </tr>
                 @endforeach
                 </tbody>
             </table>
         </div>
         <div style="display:flex;justify-content: flex-end;padding-right: 35px;width: 100%;margin-top: 15px;">
             <nav aria-label="Page navigation float-right">
                 <ul class="pagination">
                     <li class="page-item {{ $page <= 1?'disabled':'' }}">
                         <a class="page-link" href="{{ url()->current().'?page='.($page-1) }}" aria-label="Previous">
                             <span aria-hidden="true">&laquo;</span>
                         </a>
                     </li>
                     @for($i = $page -10; $i <= $page + 10; $i++)
                         @if($i > 0)
                             <li class="page-item {{ $page == $i?'active':'' }}"><a class="page-link" href="{{ url()->current().'?page='.$i }}">{{ $i }}</a></li>
                         @endif
                     @endfor

                     <li class="page-item {{ $page >= $total_page?'disabled':'' }}">
                         <a class="page-link" href="{{ url()->current().'?page='.($page+1) }}" aria-label="Next">
                             <span aria-hidden="true">&raquo;</span>
                         </a>
                     </li>
                 </ul>
             </nav>
         </div>

     </div>
    </body>
<script>
    $('.input-daterange input').each(function () {
        $(this).datepicker({
            language: 'zh-CN', //语言
            autoclose: true, //选择后自动关闭
            clearBtn: true,//清除按钮
            format: "yyyy-mm-dd"//日期格式
        });
    });
</script>
</html>
